<extend name="Public/head" />
<block name="style">
	<style type="text/css">
		.sits a{
			padding : 2px;
			border:1px solid #eee;
		}
		
	</style>
</block>
<block name="body">
    <ul class="aui-list-view">
        <volist name="list" id="vo">
            <li class="aui-list-view-cell aui-img ajax-load" data-ordersn="{$vo.order_sn}">
                <div class="aui-img-body">
                    订单编号:{$vo.order_sn}
                    <br>
                    订单状态:{:display_order_status($vo['order_status'])}
                    <br>
                    支付状态:{:display_pay_status($vo['pay_status'])}
                    <br>
                    下单时间:{$vo.addtime|time_format}
                    <br>
                    支付时间:{$vo.pay_time|time_format}
                    <br>
                    取票手机号:{$vo.mobile}
                    <br>
                    取票号:{$vo.code}
                    <br>
                    电影院:<span class="cinema"></span>
                    <br>
                    电影名称:<span class="movie"></span>
                    <br>
                    时间:<span class="start"></span>~<span class="end"></span>
                    <br>
                    座位号:<span class="rname"></span>
                    <br>
                    <span class="sits"></span>
                </div>
            </li>
        </volist>
    </ul>
</block>
<block name="script">
	<script type="text/javascript">
		window.onload = function(){
			var list = $('.ajax-load');
			list.each(function(i,v){
				var order_sn = $(v).data('ordersn');
				var data = getSeat(order_sn,$(v));
			});
		}

		function getSeat(ordersn,that){
			$.getJSON(API+"getOrderedSeat&orderno="+ordersn , function(data){
				if(data.status == 1)
				{	
					var html = "";
					$.each(data.data,function(i,v){

						html += '<a href="javascript:;">'+(v.row + 1)+'排'+ (v.col+1)+'列'+'</a>';
						$('.start',that).text(getLocalTime(v.start_time));
						$('.end',that).text(getLocalTime(v.end_time));
						$('.rname',that).text(v.rname);
						$('.cinema',that).text(v.cname);
						$('.movie',that).text(v.mname);
					});
					$('.sits',that).html(html);
				}
			});
		}

		function getLocalTime(nS) {     
 			  return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:d{1,2}$/,' '); 
 		}
	</script>
</block>
